Skip to content

Improve AbstractJdbcBatchMetadataDao::getJdbcTemplate to eliminate warnings - #5471

Closed
quaff wants to merge 1 commit into
spring-projects:mainfrom
quaff:patch-70
Closed

quaff wants to merge 1 commit into
spring-projects:mainfrom
quaff:patch-70

Conversation

@quaff

@quaff quaff commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

No description provided.

…warnings

Signed-off-by: Yanming Zhou <zhouyanming@gmail.com>
@fmbenhassine

Copy link
Copy Markdown
Contributor

Thank you for your PR. I am reviewing all your PRs regarding improvements in DAOs to merge them in order.

For this one, I am not a fan of assertions in getters. Clients calling get are expecting to get something or null, not an exception. I think passing the JDBC template to the constructor of DAOs makes the field non nullable and fixes the warnings by construction. Since we target this for 6.1, it would be fine to deprecate the default constructor in favor of the new one (if really needed). I will analyse the impact of that once I merge all your DAO-related PRs.

There is a similar occurrence of that assertion in getter for JdbcClient in #4897. I will address it in the same way afterwards.

@fmbenhassine

Copy link
Copy Markdown
Contributor

I think passing the JDBC template to the constructor of DAOs makes the field non nullable and fixes the warnings by construction. Since we target this for 6.1, it would be fine to deprecate the default constructor in favor of the new one (if really needed). I will analyse the impact of that once I merge all your DAO-related PRs.

FYI, this is done, see 729cfb6, which fixes the warnings by making the field non-nullable.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants